import request from '@/utils/request'

//分页查询列表
export function SysUserList(pageNum, pageSize, queryDto) {
  return request({
    url: `/admin/system/sysUser/findByPage/${pageNum}/${pageSize}`,
    method: 'get',
    params: queryDto,
  })
}

//添加
export function SysUserAdd(data) {
  return request({
    url: '/admin/system/sysUser/saveSysUser',
    method: 'post',
    data,
  })
}

//修改
export function SysUserUpdate(data) {
  return request({
    url: '/admin/system/sysUser/updateSysUser',
    method: 'put',
    data,
  })
}

//删除
export function SysUserDelete(userId) {
  return request({
    url: `/admin/system/sysUser/deleteSysUser/${userId}`,
    method: 'delete',
  })
}

// 查询所有的角色数据
export const GetAllRoleList1 = () => {
  return request({
    url: '/admin/system/sysRole/findAllRoles',
    method: 'get',
  })
}

//保存数据角色
export const DoAssignRoleToUser = assginRoleVo => {
  return request({
    url: '/admin/system/sysUser/doAssign',
    method: 'post',
    data: assginRoleVo,
  })
}

//角色数据回显
export const GetAllRoleList = userId => {
  return request({
    url: `/admin/system/sysRole/findAllRoles/${userId}`,
    method: 'get',
  })
}
